# coding=utf-8
import os
#import subprocess
import maya.cmds as cmds
import CommonModule
import ani
import shutil
import json
import getpass
import maya.mel as mel
#import xml.etree.cElementTree as ET
import datetime
#import ani.HUD as HUD
import re
from pipeline.pipeline_Path import *
#import core as timelimit


if not cmds.pluginInfo ("fbxmaya.mll",q=1 ,l=1 ):
	cmds.evalDeferred('cmds.loadPlugin ("fbxmaya.mll")')
if not cmds.pluginInfo ("AbcExport.mll",q=1 ,l=1 ):
	cmds.evalDeferred('cmds.loadPlugin ("AbcExport.mll")')


class Plablast_min () :

	# 路径拼写linux的文件转置写法
	
	Fonts = "C\\\:/Windows/Fonts/simhei.ttf"
	#print Fonts
	ffmpeg = "H:/RareWolf_Toolkit/Package/ffmpeg/ffmpeg.exe"
	# Min = int(cmds.playbackOptions (q =1,min=1))
	# Max = int(cmds.playbackOptions( q =1,max=1))
	cmds.setAttr("defaultResolution.w", int(LocalPath_ProjectSettingRead("ImageWidth")))
	cmds.setAttr("defaultResolution.h", int(LocalPath_ProjectSettingRead("ImageHeight")))
	print('*************************************')
	def __init__(self):

			#HUD.HUD_min().star_headsUpDisplay ()
		self.Project_Name =LocalPath_ProjectSettingRead("ProjectName")
		self.XlsxProject_Path = LocalPath_ProjectSettingRead("Project_XLSX")
		self.local_Path = LocalPath_ProjectSettingRead("Project_local_Path")
		self.ServerX_Project = LocalPath_ProjectSettingRead("Project_ServerX_Path")
		self.Server_MasterPath = self.ServerX_Project
		#self.Project_Sound = LocalPath_ProjectSettingRead("Project_ServerX_Path")

		'''
		user = getpass.getuser()
		ProjectSettings_LocalPath = 'C:/Users/' + user + '/Documents/RareWolf/'
		ProjectSettings_LocalFile = os.listdir(ProjectSettings_LocalPath)
		for tmp in ProjectSettings_LocalFile:
			if 'ProjectSettings' in tmp:
				with open(ProjectSettings_LocalPath + tmp, 'r') as f:
					json_data = json.load(f)
					self.Project_Name = json_data['Project_Name']
					self.XlsxProject_Path = json_data['Project_XLSX']
					# 本地路径
					self.local_Path = json_data['Project_local_Path']
					#网盘路径
					self.ServerX_Project = json_data['Project_ServerX_Path']
					print self.ServerX_Project
					self.Project_Sound = json_data['Project_ServerX_Path']
		'''
	def warning_Window(self):
		cmds.confirmDialog(message=u'注意！！！请在工程下制作文件,不要乱搞')
	def Plablast_bin(self):
		#if timelimit.ProductActivation().Win() == 0:
		#	return
		if cmds.headsUpDisplay('HUDDate', ex=1):
			ani.HUD_min().star_headsUpDisplay ()

		ani.HUD_min().star_headsUpDisplay ()
		'''
		File_sceneName = cmds.file(q=1, sceneName=1)
		if not self.Project_Name in File_sceneName:
			print self.Project_Name
			print File_sceneName
			self.warning_Window()
			return
		'''

		File_sceneName = cmds.file(q=1, sceneName=1)
		File_shortName = cmds.file(q=1, sceneName=1, shortName=1)
		File_Path = os.path.dirname(File_sceneName)
		File_PathSplit = File_Path.split('/')

		Set = "("+LocalPath_ProjectSettingRead("Set")+ ")"
		Set_Split = "("+LocalPath_ProjectSettingRead("Set_Split")+ ")"
		Events = "("+LocalPath_ProjectSettingRead("Events")+ ")"
		Events_Split = "("+LocalPath_ProjectSettingRead("Events_Split")+ ")"
		Lens = "("+LocalPath_ProjectSettingRead("Lens")+ ")"
		Lens_Split = "("+LocalPath_ProjectSettingRead("Lens_Split")+ ")"

		ANIcals = "("+LocalPath_ProjectSettingRead("ANI")+ ")"
		LAYcals = "("+LocalPath_ProjectSettingRead("LAY")+ ")"
		Class_Split = "("+LocalPath_ProjectSettingRead("Class_Split")+ ")"
		Version = "("+LocalPath_ProjectSettingRead("Version")+ ")"
		VersionNumber = "("+LocalPath_ProjectSettingRead("VersionNumber")+ ")"
		FileFormat = "("+LocalPath_ProjectSettingRead("FileFormat")+ ")"
		ImageWidth = int(LocalPath_ProjectSettingRead("ImageWidth"))
		ImageHeight =  int(LocalPath_ProjectSettingRead("ImageHeight"))
		Project_Frame =int(LocalPath_ProjectSettingRead("Project_Frame") )

		#print ImageWidth,ImageHeight
		cals = ''
		if re.search(ANIcals, File_sceneName):
		#if ANIcals in File_shortName:
			self.ServerX_Project = self.ServerX_Project + '/' + File_PathSplit[-5]
			cals =ANIcals

		if re.search(LAYcals, File_sceneName):
		#if LAYcals in File_shortName:
			self.ServerX_Project = self.ServerX_Project + '/' + File_PathSplit[-5]
			cals = LAYcals
		ReFileName = str(Set + Set_Split + Events + Events_Split + Lens + Lens_Split + cals + Class_Split + Version + VersionNumber + FileFormat)
		print (ReFileName)
		print (File_sceneName)
		matchObj = re.search(ReFileName, File_sceneName)
		print (matchObj.group())
		print(cals, File_PathSplit[-5])
		#print ']]]]]]]]]]]]]]]]]]]]]]]]]'
		if matchObj:
			#print '000000000000000000'
			if re.search(cals, File_PathSplit[-5]):
				ReSet = re.search(matchObj.group(1), File_PathSplit[-4])
				#print '-----------------------------------'
				if ReSet:
					ReEvents = re.search(matchObj.group(3), File_PathSplit[-3])
					#print '+++++++++++++++++++++++++++++++++++++++'
					if ReEvents :
						ReLens = re.search(matchObj.group(5),  File_PathSplit[-2])
						#print '////////////////////////////////////////////'
						if ReLens:
							#print File_PathSplit[-2]
							#print matchObj.group(5)
							pass
							#print  matchObj.group()
						else:
							print ('1')
							self.warning_Window()
							return u"文件名错误"
					else:
						print ('2')
						self.warning_Window()
						return u"文件名错误"
				else:
					print ('3')
					self.warning_Window()
					return u"文件名错误"
			else:
				print ('4')
				self.warning_Window()
				return u"文件名错误"

		else:
			print ('5')
			self.warning_Window()
			return u"文件名错误"

		self.File_shortNameVersion = matchObj.group(1) + matchObj.group(2) + matchObj.group(3) + matchObj.group(4) + matchObj.group(5) + matchObj.group(6) + matchObj.group(7)
		#print  self.File_shortNameVersion
		File_shortNameClass = matchObj.group(1) + matchObj.group(2) + matchObj.group(3) + matchObj.group(4) + matchObj.group(5) + matchObj.group(6) + matchObj.group(7) + matchObj.group(8) + matchObj.group(9) + matchObj.group(10)

		#print '66666666666666666666666666666666666'

		cmds.file(save=1)
		MaxTime = int(cmds.playbackOptions(q=1, maxTime=1))
		MinTime = int(cmds.playbackOptions(q=1, minTime=1))


		ServerXPath = self.ServerX_Project + '/' + matchObj.group(1) + '/' + matchObj.group(3) + '/' + matchObj.group(5) + '/scenes/'
		ServerXPath_images = self.ServerX_Project + '/' + matchObj.group(1) + '/' + matchObj.group(3) + '/' + matchObj.group(5) + '/images/'
		ServerXPath_movies = self.ServerX_Project + '/' + matchObj.group(1) + '/' + matchObj.group(3) + '/' + matchObj.group(5) + '/movies/'
		ServerXPath_cache = self.ServerX_Project + '/' + matchObj.group(1) + '/' + matchObj.group(3) + '/' + matchObj.group(5) + '/cache/'
		ServerPath_info = self.ServerX_Project + '/' + matchObj.group(1) + '/' + matchObj.group(3) + '/' + matchObj.group(5) + '/info/'

		if not os.path.exists(ServerXPath):
			os.makedirs(ServerXPath)
		if not os.path.exists(ServerXPath_images):
			os.makedirs(ServerXPath_images)
		if not os.path.exists(ServerXPath_movies):
			os.makedirs(ServerXPath_movies)
		if not os.path.exists(ServerXPath_cache):
			os.makedirs(ServerXPath_cache)
		if not os.path.exists(ServerPath_info):
			os.makedirs(ServerPath_info)

		wsfullName = cmds.workspace(q=True, fullName=True)
		#print '555555555555555555555555555555'
		cmds.playblast(format="image", frame=101,completeFilename=wsfullName + '/images/' + self.File_shortNameVersion + '.jpg', fr=1, sequenceTime=0,clearCache=1, viewer=1, showOrnaments=1, fp=0, percent=100, compression="jpg", quality=100, widthHeight=[1280, 720])
		########################################
		commentStr = " -metadata comment="
		RfNodes = cmds.ls (rf = 1)
		refFile = cmds.file( q=1 ,r=1)
		referenceNodeTmp =[]
		for tmp in refFile:
			referenceNodeTmp.append(cmds.referenceQuery (tmp , referenceNode = 1))
		UnReferenceNode=list(set(RfNodes) ^ set(referenceNodeTmp))
		for UnReferenceNodeList in UnReferenceNode:
			cmds.lockNode ( UnReferenceNodeList , lock = 0 )
			cmds.delete ( UnReferenceNodeList )
		#print '88888888888888888888888888888888888'
		RfNodes = cmds.ls (rf = 1)
		'''
		#视频中写入信息暂时屏蔽
		for RfNode in RfNodes :
			if re.search ( "Light",RfNode) or re.search ( "UNKNOWN_REF_NODE",RfNode) or re.search ( "Face",RfNode):
				continue
			if cmds.referenceQuery (RfNode , il = 1) :
				RfMaPath = cmds.referenceQuery (RfNode , filename = 1)
				Rfnamespace = cmds.file (RfMaPath , q = 1 , ns = 1)
				commentStr += Rfnamespace + "\\n"
				commentStr += RfMaPath + "\\n"
		print commentStr
		'''
		CommonModule.PublicWindow()
		#材质显示
		mel.eval('generateAllUvTilePreviews')
		LocalImgPath = wsfullName + '/images/' + self.File_shortNameVersion + '.jpg'
		cmds.playblast(format="image", frame=101,completeFilename = LocalImgPath, fr=1, sequenceTime=0,clearCache=1, viewer=1, showOrnaments=1, fp=0, percent=100, compression="jpg", quality=100,widthHeight=[1280, 720])

		num = []
		for tmp in range (CommonModule.MinTimes () , CommonModule.MaxTimes () + 1) :
			num.append(str (tmp).rjust (4 , '0'))
		#print '*******************************'
		cmds.select (cl=1)
		cmds.progressWindow(title=u'PlayblastWin', progress=0, isInterruptable=True, max=(len(num)))
		for index in (range (len(num))):
			cmds.progressWindow(e=1, st=u'Playblast............ {}/{}'.format(index, len(num)), step=1)
			Png_Sequence = wsfullName + '/movies/' + File_shortNameClass + '.' + str(num[index]) + ".png"
			cmds.playblast(format='image', cf= Png_Sequence ,fr=str(num[index]), compression="png", sequenceTime=0, clearCache=1, viewer=0, showOrnaments=1, fp=4,quality=100, percent=int(LocalPath_ProjectSettingRead("ImageScale")), widthHeight=[ImageWidth, ImageHeight], os=1)
		cmds.progressWindow(endProgress=1)
		cmds.deleteUI('PublicWindow',window = True)

		# 图片合成视频
		'''
		time_fps = cmds.currentUnit(q=1, t=1)
		FrameRate = ''
		if time_fps == 'game':
			fps = 15
		elif time_fps == 'film':
			fps = 24
		elif time_fps == 'pal':
			fps = 25
		elif time_fps == 'ntsc':
			fps = 30
		elif time_fps == 'show':
			fps = 48
		elif time_fps == 'palf':
			fps = 50
		elif time_fps == 'ntscf':
			fps = 60
		'''
		audioFile = ''
		audioOffset = 0
		audioFileCmd = ''
		startTime = cmds.playbackOptions(q=1, min=1)
		aPlayBackSliderPython = mel.eval('$tmpVar=$gPlayBackSlider')
		hgPlayBlastTmp = cmds.timeControl(aPlayBackSliderPython, q=1, s=1)
		if len( hgPlayBlastTmp ):
			audioOffset = int(cmds.getAttr(hgPlayBlastTmp + ".offset") - startTime)
			audioFile = cmds.sound(hgPlayBlastTmp, q=1, file=1)
		print(type(audioFile))
		offsetSec = float(audioOffset) / float(Project_Frame)
		#print (offsetSec)
		offsetCmd = ''
		if audioOffset > 0:
			offsetCmd += " -itsoffset " + str(offsetSec) + " "
		else:
			offsetCmd += " -ss " + str(abs(offsetSec)) + " "
		#print (offsetCmd)
		if len(audioFile) or os.path.exists(audioFile):#mel.eval('filetest - e audioFile')
			audioFileCmd = offsetCmd + "-i " + audioFile + " "
		if not os.path.isfile(audioFile):
			audioFileCmd = ''
		#print (audioFileCmd)
		#print '111111111111111111111111111'
		timeRange = str((CommonModule.MaxTimes() - CommonModule.MinTimes() + 1)/float(Project_Frame))
		#print (timeRange)
		#print '2222222222222222222222222222'
		File_shortName = cmds.file(q=1, sceneName=1, shortName=1)
		basenameEx = File_shortName.split('_')

		#Sound_path = self.Project_Sound  + '/Sound/' + basenameEx[0] + '/'
		MayaMov = wsfullName + '/movies/' + File_shortNameClass + ".mov"
		#print (MayaMov)
		MayaMovTemp = wsfullName + '/movies/'  + File_shortNameClass + "tmp.mov"
		#audioFileCmd = Sound_path + basenameEx[2] + '.wav'
		#os.popen(self.ffmpeg + " -r 25 -start_number " + str(CommonModule.MinTimes()) + " -i " + wsfullName + '/movies/' +File_shortNameClass[0] + ".%04d.png" + " -c:v libx264 -b 18000k -pix_fmt yuv420p -crf 1" + str(commentStr) + " -y " + MayaMovTemp)
		#os.popen(self.ffmpeg + audioFileCmd + " -i " + MayaMovTemp + " -y " + MayaMov)
		#os.remove(MayaMovTemp)
		print(self.ffmpeg + " -r 25 -start_number " + str(CommonModule.MinTimes()) + " -i " + wsfullName + '/movies/' +File_shortNameClass + ".%04d.png" + audioFileCmd + " -t "+ timeRange + " -c:v libx264 -b 18000k -pix_fmt yuv420p -crf 1" + str(commentStr) + " -y " + MayaMov)
		os.popen(self.ffmpeg + " -r 25 -start_number " + str(CommonModule.MinTimes()) + " -i " + wsfullName + '/movies/' +File_shortNameClass + ".%04d.png" + audioFileCmd + " -t "+ timeRange + " -c:v libx264 -b 18000k -pix_fmt yuv420p -crf 1" + str(commentStr) + " -y " + MayaMov)
		#os.popen(self.ffmpeg + audioFileCmd + " -i " + MayaMovTemp + " -y " + MayaMov)
		#os.remove(MayaMovTemp)

		#if basenameEx[2] + '.wav' in os.listdir(Sound_path):
		#	os.popen(self.ffmpeg + " -r 25 -start_number " + str(CommonModule.MinTimes()) + " -i " + wsfullName + '/movies/' + File_shortNameClass[0] + ".%04d.png" + " -c:v libx264 -b 18000k -pix_fmt yuv420p -crf 1" + str(commentStr) + " -y " + MayaMovTemp)
		#	os.popen(self.ffmpeg + audioFileCmd + " -i " + MayaMovTemp + " -y " + MayaMov)
		#	os.remove(MayaMovTemp)
		#else:
		#	os.popen(self.ffmpeg + " -r 25 -start_number " + str(CommonModule.MinTimes()) + " -i " + wsfullName + '/movies/' +File_shortNameClass[0] + ".%04d.png" + " -c:v libx264 -b 18000k -pix_fmt yuv420p -crf 1" + str(commentStr) + " -y " + MayaMov)

		#os.system (self.ffmpeg + " -r 25 -start_number " + str (CommonModule.MinTimes ()) + " -i " + wsfullName + '/movies/'  + File_shortNameClass[0] + ".%04d.png" " -acodec copy -vcodec libx264 -b 18000k -pix_fmt yuv420p -crf 1" + str (commentStr) + " -y " + wsfullName + '/movies/'  + File_shortNameClass[0] + ".mov")

		# 烘焙相机
		CamShapeTmps = ['frontShape', 'perspShape', 'sideShape', 'topShape']
		allCamShape = cmds.ls(type = 'camera')
		Ani_camTmp = list(set(allCamShape) - set(CamShapeTmps))
		old_cam = cmds.listRelatives(Ani_camTmp, p = 1)
		new_cam = cmds.camera(n = 'jesus')
		cmds.parentConstraint(old_cam, new_cam[0])
		old_cam_shape = cmds.listRelatives(old_cam, shapes = True, children = True)[0]
		new_cam_shape = cmds.listRelatives(new_cam, shapes = True, children = True)[0]
		cmds.connectAttr(old_cam_shape + '.focalLength', new_cam_shape + '.focalLength ')
		cmds.connectAttr(old_cam_shape + '.horizontalFilmAperture', new_cam_shape + '.horizontalFilmAperture ')
		cmds.connectAttr(old_cam_shape + '.verticalFilmAperture', new_cam_shape + '.verticalFilmAperture ')
		cmds.connectAttr(old_cam_shape + '.lensSqueezeRatio', new_cam_shape + '.lensSqueezeRatio ')
		cmds.connectAttr(old_cam_shape + '.fStop', new_cam_shape + '.fStop ')
		cmds.connectAttr(old_cam_shape + '.focusDistance', new_cam_shape + '.focusDistance ')
		cmds.connectAttr(old_cam_shape + '.shutterAngle', new_cam_shape + '.shutterAngle ')
		cmds.connectAttr(old_cam_shape + '.centerOfInterest', new_cam_shape + '.centerOfInterest ')
		# cmds.connectAttr (Ani_camTmp[0] + '.locatorScale' , cameraName[1] + '.locatorScale ')
		# cmds.connectAttr (Ani_camTmp[0] + '.rsStereoSphericalSeparation' , cameraName[1] + '.rsStereoSphericalSeparation')
		# cmds.connectAttr (Ani_camTmp[0] + '.rsStereoSphericalFocusDistance' ,cameraName[1] + '.rsStereoSphericalFocusDistance')
		# cmds.connectAttr (Ani_camTmp[0] + '.rsStereoCubeSeparation' , cameraName[1] + '.rsStereoCubeSeparation ')
		cmds.bakeResults(new_cam, t=(CommonModule.MinTimes(), CommonModule.MaxTimes()), sampleBy=1)
		# simulation = 1 , oversamplingRate = 1 , disableImplicitControl = 1 , preserveOutsideKeys = 1 , sparseAnimCurveBake = 0 , removeBakedAttributeFromLayer = 0 , removeBakedAnimFromLayer = 0 , bakeOnOverrideLayer = 0 , minimizeRotation = 1 , controlPoints = 0
		cmds.delete(new_cam, constraints=1)
		new_cam = cmds.rename(new_cam[0], matchObj.group(1) + matchObj.group(2) + matchObj.group(3) + matchObj.group(4) +matchObj.group(5))
		cmds.select(new_cam)

		wsfullName = cmds.workspace(q=True, fullName=True)
		cmds.file(wsfullName + '/cache/' + matchObj.group(1) + matchObj.group(2) + matchObj.group(3) + matchObj.group(4) +matchObj.group(5) + "-cam" ,force=1, options="v=0;", typ="mayaAscii", pr=1, es=1)
		cmds.file(wsfullName + '/cache/' + matchObj.group(1) + matchObj.group(2) + matchObj.group(3) + matchObj.group(4) +matchObj.group(5) + "-cam.fbx", force=1, options="v=0;", typ="FBX export", pr=1, es=1)
		if cmds.window("FbxWarningWindow", exists=1):
			cmds.deleteUI('FbxWarningWindow', window=True)
		cmds.delete(new_cam)

		for tmp in os.listdir(wsfullName + '/movies/') :
			if '.png' in tmp :
				#print tmp
				os.remove(wsfullName + '/movies/' + tmp)
		os.startfile(MayaMov)

		To_ServerScenePath = ServerXPath + self.File_shortNameVersion + matchObj.group(11)
		To_ServerMovPath = ServerXPath_movies + self.File_shortNameVersion + '.mov'
		To_ServerImgPath= ServerXPath_images + self.File_shortNameVersion + '.jpg'



		for tmp in os.listdir(wsfullName + '/scenes/') :
			log_info_txt = matchObj.group(1) + matchObj.group(2) + matchObj.group(3) + matchObj.group(4) +matchObj.group(5)  + matchObj.group(6) + matchObj.group(7) + '_log.txt'
			print(log_info_txt)
			if log_info_txt in tmp :
				print(tmp)
		
				log_info = wsfullName + '/scenes/' +tmp
				print(log_info)
				#log_info_ServerPath = ServerXPath + log_info_txt
				#print(log_info_ServerPath)
				shutil.copy(log_info, ServerPath_info)



		shutil.copy(File_sceneName, To_ServerScenePath)

		shutil.copy(MayaMov, To_ServerMovPath)
		shutil.copy(LocalImgPath,To_ServerImgPath)
		shutil.copy(wsfullName + '/cache/' + matchObj.group(1) + matchObj.group(2) + matchObj.group(3) + matchObj.group(4) +matchObj.group(5) + "-cam" +  matchObj.group(11),	ServerXPath_cache  + matchObj.group(1) + matchObj.group(2) + matchObj.group(3) + matchObj.group(4) +matchObj.group(5) + "-cam" +  matchObj.group(11))
		shutil.copy(wsfullName + '/cache/' + matchObj.group(1) + matchObj.group(2) + matchObj.group(3) + matchObj.group(4) +matchObj.group(5) + "-cam.fbx",						ServerXPath_cache + matchObj.group(1) + matchObj.group(2) + matchObj.group(3) + matchObj.group(4) +matchObj.group(5) + "-cam.fbx")

		NewReFileName = matchObj.group(1)  + matchObj.group(3)  +matchObj.group(5) + matchObj.group(6) + matchObj.group(7) + matchObj.group(11)
		
		setAllFilePath = self.Server_MasterPath + '/' + matchObj.group(1).split('_')[1]  + '/' + matchObj.group(7)
		
		if not os.path.exists(setAllFilePath):
			os.makedirs(setAllFilePath)

		shutil.copy(MayaMov, setAllFilePath + '/' + matchObj.group(1)  + matchObj.group(3)  +matchObj.group(5) + matchObj.group(6) +matchObj.group(7)  + ".mov")
		shutil.copy(File_sceneName, setAllFilePath + '/' + NewReFileName)
		'''
		if not os.path.exists(self.ServerX_Project + '/' + Set.split('_')[0] + '/' +cals):
			os.makedirs(self.ServerX_Project + '/' + Set.split('_')[0] + '/' +cals)
		
		shutil.copy(MayaMov, self.ServerX_Project + '/' + Set.split('_')[0] + '/' +cals + '/' + NewReFileName + ".mov")
		shutil.copy(MayaMov, self.ServerX_Project + '/' + Set.split('_')[0] + '/' +cals + '/' + NewReFileName + FileFormat)
		'''
		# 获取信息
		assect_json = {}
		assect_json['NameVode'] = str(self.File_shortNameVersion)
		assect_json['Time'] = str(MinTime) + '-' + str(MaxTime)
		assect_json['TotalFrames'] = str(MaxTime - MinTime + 1)
		assect_json['date'] = str(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
		assect_json['version'] = str(matchObj.group(10))
		#print '********************************************************************************'
		user = getpass.getuser()
	

		ProjectSettings_LocalPath = 'C:/Users/' + user + '/Documents/RareWolf/'
		ProjectSettings_LocalFile = os.listdir(ProjectSettings_LocalPath)
		for tmp in ProjectSettings_LocalFile:
			if 'UserName' in tmp:
				with open(ProjectSettings_LocalPath + tmp, 'r') as f:
					UserName_json_data = json.load(f)
					UserName = UserName_json_data['UserName']
				assect_json['UserName'] = str(UserName)
	
		# 导出信息

		json_Path = cmds.workspace ( fullName = True ) + '/info/' + self.File_shortNameVersion + '-publishInfo.json'
		#print  (json_Path)
		#out_file = open(json_Path, 'w')
		#json.dump(assect_json, out_file, indent=4)
		#out_file.close()
		with open(json_Path,'w') as file:
			json.dump(assect_json,file)

		shutil.copy(json_Path, ServerPath_info)
#Plablast_min().Plablast_bin()



